<?php
/**
 * Created by PhpStorm.
 * User: Tsang
 * Date: 2017/9/24 16:20
 *
 */

namespace app\driver\model;

use think\Model;

class DriverWithdrawals extends Model
{
    /**
     * 获取余额
     * @param $original
     * @return array
     */
    public function getUserBalance($uid)
    {
         //金额增加
        $add_money = db('driver_balance')->where(['driver_id'=>$uid])->sum('money');

        //提现金额减少
        $member_withdrawals = db('driver_withdrawals')->where(['driver_id'=>$uid,'status'=>['in',['0','1']]])->sum('money');

        $user_balance = $add_money - $member_withdrawals;

        return $user_balance;
    }
   

}